/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import * as path from 'path';
import { parseJsonFile } from '../../../../src/common/util/parse-json/parse-json-util';
import { JsonReader } from '../../../../src/base/util/json-reader';

const jsonFilePath = path.resolve('test/resource/snapshot/file-snapshot.json');

describe('test json reader', () => {

  test('test reader', () => {
    const jsonObj = JsonReader.getJsonObj(jsonFilePath);
    expect(jsonObj.hashValue).toBe('9fcfaa8a916bfb3d1dd685c0ba149ea9');
    expect(jsonObj.isSymbolicLink).toBeFalsy();
  });

  test('test parse json with row&column', () => {
    const jsonObj = parseJsonFile(jsonFilePath, true);
    expect(jsonObj._line).toBe(1);
    expect(jsonObj._column).toBe(1);
    expect(jsonObj.path._line).toBe(4);
    expect(jsonObj.path._column).toBe(42);
  });
});
